//
//  HYReceivedCompensateVC.m
//  HaiYue
//
//  Created by skyline on 2018/1/12.
//  Copyright © 2018年 skyline. All rights reserved.
//

#import "HYReceivedVC.h"
#import "HYReceivedFlowLayout.h"
#import "HYReceivedCell.h"
@interface HYReceivedVC()<UICollectionViewDelegate, UICollectionViewDataSource>
@property (nonatomic, strong) UICollectionView *collectionView;

@end
@implementation HYReceivedVC
- (instancetype)init
{
    self = [super init];
    if (self)
    {
        self.backgroundColor = LINE_COLOR;
        self.collectionView.hidden = NO;
    }
    return self;
}

- (UICollectionView *)collectionView
{
    if (!_collectionView)
    {
        _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, HYOnlineBarCellHeight) collectionViewLayout:[[HYReceivedFlowLayout alloc] init]];
        [_collectionView registerClass:[HYReceivedCell class] forCellWithReuseIdentifier:@"HYReceivedCell"];
        _collectionView.backgroundColor = [UIColor clearColor];
        _collectionView.bounces = NO;
        _collectionView.delegate = self;
        _collectionView.dataSource = self;
        [self addSubview:_collectionView];
        [_collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.mas_offset(UIEdgeInsetsZero);
        }];
    }
    return _collectionView;
}

#pragma mark CollectionViewDelegate&DataSource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return 30;
}

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    return 2;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString* cellId = @"HYReceivedCell";
    HYReceivedCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellId forIndexPath:indexPath];
    cell.style = (indexPath.row == 0)?HYReceivedCellClearStyle:HYReceivedCellDefaultStyle;
    return cell;
}
/*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect {
 // Drawing code
 }
 */

@end
